function Score(option, cells) {
  BgSprite.apply(this, arguments);
  this.n = option.n;
  this.cells = cells;
  this.change = 0;
  this.index = option.index || 0;
}
Score.prototype = {
  draw: function() {
    ctx.save();
    ctx.drawImage(this.img, this.cells[0].x, this.index * 60, this.cells[0].w, this.cells[0].h,
      this.left - this.cells[0].w / 2, this.top - this.cells[0].h / 2, this.cells[0].w, this.cells[0].h);
    ctx.restore();
  },
  update: function() {
    if (this.change % 5 == 0) {
      this.index++;
      if (this.index == 9) {
        this.index = 0;
      }
    }
    this.change++;
  }
}

function createScore(n, obj) {
  var cells = [{
    x: 0,
    y: 0,
    h: 60,
    w: 60
  }]
  var score = new Score({
    url: "img/coinAni" + n + ".png",
    // url: "img/coinAni2.png",
    x: obj.w,
    y: obj.h,
  }, cells);
  return score;
}
